dofile ("libButton.lua")

button1 = Button.new(SCREEN_DOWN, 5, 5, 100, 25, "Button 1")
button2 = Button.new(SCREEN_DOWN, 5, 50, 100, 25, "Button 2")

txt = ""

while not Keys.newPress.Start do
  
  Controls.read()
  
  startDrawing()
    
    button1:draw ()
    button2:draw ()
    
    screen.print (SCREEN_UP, 5, 5, txt)
    
    if button1:clicked () then
      txt = "Button 1 clicked"
    elseif button2:clicked () then
      txt = "Button 2 clicked"
    end
    
  stopDrawing()
  
end

txt = nil

button1:clear ()
button2:clear ()

